package com.study.controller;

import com.study.common.Result;
import com.study.common.ResultCode;
import com.study.entity.atte.AttendanceConfig;
import com.study.service.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author wfw
 * @Date 2020/08/01 22:02
 */
@RestController
@RequestMapping("cfg")
public class ConfigController extends BaseController {

    @Autowired
    private ConfigurationService configurationService;

    /**
     * 获取考勤设置
     */
    @PostMapping("atte/item")
    public Result atteConfig(String departmentId){
        AttendanceConfig ac = configurationService.getAtteConfig(companyId , departmentId);
        return new Result(ResultCode.SUCCESS , ac);
    }

    /**
     * 保存考勤设置
     */
    @PutMapping("atte")
    public Result saveAtteConfig(@RequestBody AttendanceConfig ac){
        ac.setCompanyId(companyId );
        configurationService.saveAtteConfig(ac);
        return new Result(ResultCode.SUCCESS);
    }

}
